<link href="/assets/third-party/iCheck-master/skins/square/green.css" rel="stylesheet">
<div class="container" style="margin-top: 60px;">
    <div class="row" style="margin-top: 10px;">
        <div class="col-sm-2"></div>
        <div class="col-sm-8">
            <form  class="form-horizontal" role="form" action="/admin/wxaction/<?php echo isset($item) ? "edit/{$item->id}" : "create"; ?>" method="post"> 
                <?php if( ! isset($item) || !(in_array(\Input::get('type'), array('subscribe', '*')))){ ?>
                <div class="form-group">
                    <label for="keyword" class="col-sm-2 control-label">关键字</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="keyword" name="keyword" placeholder="关键字" value="<?php echo isset($item) ? $item->keyword : ''; ?>">
                    </div>
                </div>
                <div class="form-group">
                    <label for="pattern" class="col-sm-2 control-label">模式</label>
                    <div class="col-sm-10">
                        <input type="radio" id="pattern" name="pattern" value="="<?php echo !isset($item) || (isset($item) && $item->pattern == '=') ? ' checked="checked"' : ''; ?>> 精确匹配 
                        <input type="radio" name="pattern" value="LIKE" <?php echo isset($item) && $item->pattern == 'LIKE' ? ' checked="checked"'  : ''; ?>> 模糊匹配
                    </div>                    
                </div>
                <?php } ?>
                <div class="form-group">
                    <label for="material" class="col-sm-2 control-label">内容</label>
                    <div class="col-sm-10">
                        <textarea id="material" name="content" style="width: 100%; height: 50px;" placeholder="列表页显示的内容，内容请不要太长"><?php echo isset($item) ? $item->material->content : ''; ?></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <a href="/admin<?php echo ! isset($item) || !(in_array($item->keyword, array('subscribe', '*'))) ? '/wxaction' : ''; ?>" class="btn btn-default"> 返回 </a> 
                        <button type="submit" class="btn btn-success"> 保存 </button>
                    </div>
                </div>
            </form>
        </div>
        <div class="col-sm-2"></div>
    </div>
</div>
<?php echo render('edu/public/upload'); ?>

<script type="text/javascript">
    var path = 'images';
    var imgpanel = '';


    function callback(file, data){
        var json = eval('(' + data + ')');
        if(json.status == 'succ'){
            $("#thumbnail").val(json.data);
        }else{
            alert(json.msg);
        }
    }
</script>

<script type="text/javascript" src="/assets/third-party/editor/kindeditor-min.js"></script>
<script type="text/javascript" src="/assets/third-party/editor//lang/zh_CN.js"></script>
<script type="text/javascript">
    var editor;
    KindEditor.ready(function(K) {
        editor = K.create('textarea', {
            allowFileManager : false,
            items:['fullscreen', 'image', 'emoticons', 'link']
        });
    });
</script>

<script type="text/javascript" src="/assets/third-party/iCheck-master/icheck.min.js"></script>
<script type="text/javascript">
$(function(){

    $('input').iCheck({
        checkboxClass: 'icheckbox_square-green',
        radioClass: 'iradio_square-green',
        increaseArea: '20%' // optional
    });
});
</script>